<?php

//include("headerins.php");

print '

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="css/style.css" type="text/css" />
    </head>
    <body>
        <div id="contextCaption">Просморт списка товаров.</div>
        <hr>
            <table border="0" id="contextGrid">
                <thead>
                    <tr>
                    	<th>№</th>
                    	<th>Дистрибьютор</th>
                        <th>Покупатель</th>
                        <th>Дата</th>
                        <th>Описание</th>
                    </tr>
                </thead>
                <tbody>
                ';
                
                          $con = mysql_connect("localhost","root","555");
                          if (!$con)
                            {
                            die('Could not connect: ' . mysql_error());
                            }

                          mysql_select_db("mlm", $con);
                          $sql = '
                                SELECT 
                                    Id, 
                                    UserId, 
                                    UserIdTo, 
                                    CreateDT, 
                                    Description 
                                FROM OrderHead  
                          ';
                          $result = mysql_query($sql);
                            if (!$result) {
                                echo 'Ошибка запроса: ' . mysql_error();
                                exit;
                            }
                          while($row = mysql_fetch_array($result)){
                              echo "<tr>";
                              echo "<td> " .$row['Id']. "</td>";
                              echo "<td> " .$row['UserId'] . "</td>";
                              echo "<td> " .$row['UserIdTo'] . "</td>";
                              echo "<td> " .$row['CreateDT'] . "</td>";
                              echo "<td> " .$row['Description'] . "</td>";
                              echo "<td style='padding: 2 0 2 0;'>  <img src='Pictures/Pencil.ico' alt='Изменить запись заказ' widht=12 height=12> </td>";
                              echo "<td style='padding: 2 0 2 0;'>  <img src='Pictures/Trash-empty.ico' alt='Удалить запись заказ' widht=12 height=12> </td>";
                              echo "</tr>";
                            }

                          mysql_close($con);
                print '                
                </tbody>
            </table>
            <hr>
            <input id="button" type="Button"  value="Печать" title="Печать заказа">            
            <input id="button" type="Button"  value="Создать" title="Создать новый заказ">

    </body>
</html>
';

?>
